<!DOCTYPE html>
<html id="docs" lang="en" class="">
	<head>
	<meta charset="utf-8">
<title>Kubernetes 201 - Kubernetes</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="shortcut icon" type="image/png" href="../../../images/favicon.png">
<link rel="stylesheet" type="text/css" href="../../../css/base_fonts.css">
<link rel="stylesheet" type="text/css" href="../../../css/styles.css">
<link rel="stylesheet" type="text/css" href="https://code.jquery.com/ui/1.12.1/themes/smoothness/jquery-ui.css">
<link rel="stylesheet" type="text/css" href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css">
<link rel="stylesheet" type="text/css" href="../../../css/callouts.css">
<link rel="stylesheet" type="text/css" href="../../../css/custom-jekyll/tags.css">




<meta name="description" content="Kubernetes 201" />
<meta property="og:description" content="Kubernetes 201" />

<meta property="og:url" content="https://kubernetes.io/docs/tutorials/k8s201/" />
<meta property="og:title" content="Kubernetes 201 - Kubernetes" />

<script
src="https://code.jquery.com/jquery-3.2.1.min.js"
integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4="
crossorigin="anonymous"></script>
<script
src="https://code.jquery.com/ui/1.12.1/jquery-ui.min.js"
integrity="sha256-VazP97ZCwtekAsvgPBSUwPFKdrwD3unUfSGVYrahUqU="
crossorigin="anonymous"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
<script src="../../../js/script.js"></script>
<script src="../../../js/custom-jekyll/tags.js"></script>


	</head>
	<body>
		<div id="cellophane" onclick="kub.toggleMenu()"></div>

<header>
    <a href="../../../index.html" class="logo"></a>

    <div class="nav-buttons" data-auto-burger="primary">
        <ul class="global-nav">
            
            
            <li><a href="../../home.1">Documentation</a></li>
            
            <li><a href="../../../blog/index.html">Blog</a></li>
            
            <li><a href="../../../partners/index.html">Partners</a></li>
            
            <li><a href="../../../community/index.html">Community</a></li>
            
            <li><a href="../../../case-studies/index.html">Case Studies</a></li>
            
            
             <li>
                <a href="../../user-guide/walkthrough/k8s201/index.html#">
                    English <span class="ui-icon ui-icon-carat-1-s"></span>
                </a>
                <ul>
                
                    <li><a href="../../../zh/index.html">中文 Chinese</a></li>
                
                    <li><a href="../../../ko/index.html">한국어 Korean</a></li>
                
                </ul>
            </li>
         
            <li>
                <a href="../../user-guide/walkthrough/k8s201/index.html#">
                    v1.11 <span class="ui-icon ui-icon-carat-1-s"></span>
                </a>
                <ul>
                
                    <li><a href="https://kubernetes.io">v1.12</a></li>
                
                    <li><a href="../../../index.html">v1.11</a></li>
                
                    <li><a href="https://v1-10.docs.kubernetes.io">v1.10</a></li>
                
                    <li><a href="https://v1-9.docs.kubernetes.io">v1.9</a></li>
                
                </ul>
            </li>
        </ul>
        
        <a href="../kubernetes-basics/index.html" class="button" id="tryKubernetes" data-auto-burger-exclude>Try Kubernetes</a>
        <button id="hamburger" onclick="kub.toggleMenu()" data-auto-burger-exclude><div></div></button>
    </div>

    <nav id="mainNav">
        <main data-auto-burger="primary">
        <div class="nav-box">
            <h3><a href="../stateless-application/hello-minikube/index.html">Get Started</a></h3>
            <p>Ready to get your hands dirty? Build a simple Kubernetes cluster that runs "Hello World" for Node.js.</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../home.1">Documentation</a></h3>
            <p>Learn how to use Kubernetes with the use of walkthroughs, samples, and reference documentation. You can even <a href="../../../editdocs/index.html" data-auto-burger-exclude>help contribute to the docs</a>!</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../../community/index.html">Community</a></h3>
            <p>If you need help, you can connect with other Kubernetes users and the Kubernetes authors, attend community events, and watch video presentations from around the web.</p>
        </div>
        <div class="nav-box">
            <h3><a href="../../../blog/index.html">Blog</a></h3>
            <p>Read the latest news for Kubernetes and the containers space in general, and get technical how-tos hot off the presses.</p>
        </div>
        </main>
        <main data-auto-burger="primary">
        <div class="left">
            <h5 class="github-invite">Interested in hacking on the core Kubernetes code base?</h5>
            <a href="https://github.com/kubernetes/kubernetes" class="button" data-auto-burger-exclude>View On Github</a>
        </div>

        <div class="right">
            <h5 class="github-invite">Explore the community</h5>
            <div class="social">
                <a href="https://twitter.com/kubernetesio" class="twitter"><span>Twitter</span></a>
                <a href="https://github.com/kubernetes/kubernetes" class="github"><span>Github</span></a>
                <a href="http://slack.k8s.io/" class="slack"><span>Slack</span></a>
                <a href="http://stackoverflow.com/questions/tagged/kubernetes" class="stack-overflow"><span>Stack Overflow</span></a>
                <a href="https://discuss.kubernetes.io" class="mailing-list"><span>Forum</span></a>
                <a href="https://calendar.google.com/calendar/embed?src=nt2tcnbtbied3l6gi2h29slvc0%40group.calendar.google.com" class="calendar"><span>Events Calendar</span></a>
            </div>
        </div>
        <div class="clear" style="clear: both"></div>
        </main>
    </nav>
</header>

		
		
		<section id="hero" class="light-text no-sub">
			













<h1>Tutorials</h1>
<h5></h5>




<div id="vendorStrip" class="light-text">
	<ul>
		
		
		<li><a href="../../home.1">DOCUMENTATION</a></li>
		
		
		<li><a href="../../setup/index.html">SETUP</a></li>
		
		
		<li><a href="../../concepts/index.html">CONCEPTS</a></li>
		
		
		<li><a href="../../tasks/index.html">TASKS</a></li>
		
		
		<li><a href="../index.html" class="YAH">TUTORIALS</a></li>
		
		
		<li><a href="../../reference.1">REFERENCE</a></li>
		
	</ul>
	<div id="searchBox">
		<input type="text" id="search" placeholder="Search" onkeydown="if (event.keyCode==13) window.location.replace('/docs/search/?q=' + this.value)" autofocus="autofocus">
	</div>
</div>

		</section>
		
		
<section id="deprecationWarning">
  <main>
    <div class="content deprecation-warning">
      <h3>
        Documentation for Kubernetes v1.11 is no longer actively maintained. The version you are currently viewing is a static snapshot.
        For up-to-date documentation, see the <a href="https://kubernetes.io/docs/home/">latest</a> version.
      </h3>
    </div>
  </main>
</section>


		<section id="encyclopedia">
			
<div id="docsToc">
     <div class="pi-accordion">
    	
        
        
        
        
        
         
             
                 
             
         
             
                 
             
         
             
                 
             
         
             
                 
             
         
             
                 
             
         
             
                 
                          
                          
                 
             
         
             
         
             
         
         
        
        <a class="item" data-title="Tutorials" href="../index.html"></a>

	
	
		
		
<a class="item" data-title="Hello Minikube" href="../stateless-application/hello-minikube/index.html"></a>

		
	
		
		
	<div class="item" data-title="Kubernetes Basics">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Overview" href="../kubernetes-basics/index.html"></a>

		
	
		
		
	<div class="item" data-title="Create a Cluster">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Using Minikube to Create a Cluster" href="../kubernetes-basics/cluster-intro/index.html"></a>

		
	
		
		
<a class="item" data-title="Interactive Tutorial - Creating a Cluster" href="../kubernetes-basics/cluster-interactive/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Deploy an App">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Using kubectl to Create a Deployment" href="../kubernetes-basics/deploy-intro/index.html"></a>

		
	
		
		
<a class="item" data-title="Interactive Tutorial - Deploying an App" href="../kubernetes-basics/deploy-interactive/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Explore Your App">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Viewing Pods and Nodes" href="../kubernetes-basics/explore-intro/index.html"></a>

		
	
		
		
<a class="item" data-title="Interactive Tutorial - Exploring Your App" href="../kubernetes-basics/explore-interactive/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Expose Your App Publicly">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Using a Service to Expose Your App" href="../kubernetes-basics/expose-intro/index.html"></a>

		
	
		
		
<a class="item" data-title="Interactive Tutorial - Exposing Your App" href="../kubernetes-basics/expose-interactive/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Scale Your App">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Running Multiple Instances of Your App" href="../kubernetes-basics/scale-intro/index.html"></a>

		
	
		
		
<a class="item" data-title="Interactive Tutorial - Scaling Your App" href="../kubernetes-basics/scale-interactive/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Update Your App">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Performing a Rolling Update" href="../kubernetes-basics/update-intro/index.html"></a>

		
	
		
		
<a class="item" data-title="Interactive Tutorial - Updating Your App" href="../kubernetes-basics/update-interactive/index.html"></a>

		
	

		</div>
	</div>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Online Training Courses">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Overview of Kubernetes Online Training" href="../online-training/overview/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Configuration">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Configuring Redis using a ConfigMap" href="../configuration/configure-redis-using-configmap/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Stateless Applications">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Exposing an External IP Address to Access an Application in a Cluster" href="../stateless-application/expose-external-ip-address/index.html"></a>

		
	
		
		
<a class="item" data-title="Example: Deploying PHP Guestbook application with Redis" href="../stateless-application/guestbook/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Stateful Applications">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="StatefulSet Basics" href="../stateful-application/basic-stateful-set/index.html"></a>

		
	
		
		
<a class="item" data-title="Example: Deploying WordPress and MySQL with Persistent Volumes" href="../stateful-application/mysql-wordpress-persistent-volume/index.html"></a>

		
	
		
		
<a class="item" data-title="Example: Deploying Cassandra with Stateful Sets" href="../stateful-application/cassandra/index.html"></a>

		
	
		
		
<a class="item" data-title="Running ZooKeeper, A Distributed System Coordinator" href="../stateful-application/zookeeper/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Clusters">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="AppArmor" href="../clusters/apparmor/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
	<div class="item" data-title="Services">
		<div class="container">
		
		
	
	
		
		
<a class="item" data-title="Using Source IP" href="../services/source-ip/index.html"></a>

		
	

		</div>
	</div>

		
	
		
		
<a class="item" data-title="Kubernetes 101" href="../../user-guide/walkthrough/index.html"></a>

		
	
		
		
<a class="item" data-title="Kubernetes 201" href="../../user-guide/walkthrough/k8s201/index.html"></a>

		
	






     </div> 
    <button class="push-menu-close-button" onclick="kub.toggleToc()"></button>
</div> 

			<div id="docsContent">
				
<p><a href="../../editdocs#docs/tutorials/k8s201.md" id="editPageButton">Edit This Page</a></p>

<h1>Kubernetes 201</h1>





<nav id="TableOfContents">
<ul>
<li>
<ul>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#labels-deployments-services-and-health-checking">Labels, Deployments, Services and Health Checking</a></li>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#labels">Labels</a></li>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#deployments">Deployments</a>
<ul>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#deployment-management">Deployment Management</a></li>
</ul></li>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#services">Services</a>
<ul>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#service-management">Service Management</a></li>
</ul></li>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#health-checking">Health Checking</a>
<ul>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#process-health-checking">Process Health Checking</a></li>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#application-health-checking">Application Health Checking</a></li>
</ul></li>
<li><a href="../../user-guide/walkthrough/k8s201/index.html#what-s-next">What&rsquo;s Next?</a></li>
</ul></li>
</ul>
</nav>

<h2 id="labels-deployments-services-and-health-checking">Labels, Deployments, Services and Health Checking</h2>

<p>If you went through <a href="../../user-guide/walkthrough/index.html">Kubernetes 101</a>, you learned about kubectl, Pods, Volumes, and multiple containers.
For Kubernetes 201, we will pick up where 101 left off and cover some slightly more advanced topics in Kubernetes, related to application productionization, Deployment and
scaling.</p>

<p><p>You need to have a Kubernetes cluster, and the kubectl command-line tool must
be configured to communicate with your cluster. If you do not already have a
cluster, you can create one by using
<a href="../../getting-started-guides/minikube">Minikube</a>,
or you can use one of these Kubernetes playgrounds:</p>

<ul>
<li><a href="https://www.katacoda.com/courses/kubernetes/playground" target="_blank">Katacoda</a></li>
<li><a href="http://labs.play-with-k8s.com/" target="_blank">Play with Kubernetes</a></li>
</ul>
 
 To check the version, enter <code>kubectl version</code>.
</p>

<p>In order for the kubectl usage examples to work, make sure you have an examples directory locally, either from <a href="https://github.com/kubernetes/kubernetes/releases" target="_blank">a release</a> or <a href="https://github.com/kubernetes/kubernetes" target="_blank">the source</a>.</p>

<h2 id="labels">Labels</h2>

<p>Having already learned about Pods and how to create them, you may be struck by an urge to create many, many Pods.  Please do!  But eventually you will need a system to organize these Pods into groups.  The system for achieving this in Kubernetes is Labels.  Labels are key-value pairs that are attached to each object in Kubernetes.  Label selectors can be passed along with a RESTful <code>list</code> request to the apiserver to retrieve a list of objects which match that label selector.</p>

<p>To add a label, add a labels section under metadata in the Pod definition:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml"><span style="color:#bbb">  </span>labels:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>app:<span style="color:#bbb"> </span>nginx</code></pre></div>
<p>For example, here is the nginx Pod definition with labels (<a href="../pod-nginx-with-label.yaml">pod-nginx-with-label.yaml</a>):</p>



 













<table class="includecode" id="pod-nginx-with-label-yaml">
    <thead>
        <tr>
            <th>
                <a href="https://github.com/kubernetes/website/blob/master/content/en/docs/tutorials/pod-nginx-with-label.yaml" download="pod-nginx-with-label.yaml">
                    <code>pod-nginx-with-label.yaml docs/tutorials</code>
                </a>
                <img src="../../../images/copycode.svg" style="max-height:24px" onclick="copyCode('pod-nginx-with-label-yaml')" title="Copy pod-nginx-with-label.yaml to clipboard">
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Pod<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">  </span>labels:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>app:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>containers:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">    </span>image:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">    </span>ports:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>containerPort:<span style="color:#bbb"> </span><span style="color:#666">80</span><span style="color:#bbb">
</span><span style="color:#bbb"></span></code></pre></div>  </td>
        </tr>
    </tbody>
</table>



<p>Create the labeled Pod (<a href="../pod-nginx-with-label.yaml">pod-nginx-with-label.yaml</a>):</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f https://k8s.io/docs/tutorials/pod-nginx-with-label.yaml</code></pre></div>
<p>List all Pods with the label <code>app=nginx</code>:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl get pods -l <span style="color:#b8860b">app</span><span style="color:#666">=</span>nginx</code></pre></div>
<p>Delete the Pod by label:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl delete pod -l <span style="color:#b8860b">app</span><span style="color:#666">=</span>nginx</code></pre></div>
<p>For more information, see <a href="../../user-guide/labels">Labels</a>.
They are a core concept used by two additional Kubernetes building blocks: Deployments and Services.</p>

<h2 id="deployments">Deployments</h2>

<p>Now that you know how to make awesome, multi-container, labeled Pods and you want to use them to build an application, you might be tempted to just start building a whole bunch of individual Pods, but if you do that, a whole host of operational concerns pop up.  For example: how will you scale the number of Pods up or down?  How will you roll out a new release?</p>

<p>The answer to those questions and more is to use a <a href="../../concepts/workloads/controllers/deployment/index.html">Deployment</a> to manage maintaining and updating your running <em>Pods</em>.</p>

<p>A Deployment object defines a Pod creation template (a &ldquo;cookie-cutter&rdquo; if you will) and desired replica count.  The Deployment uses a label selector to identify the Pods it manages, and will create or delete Pods as needed to meet the replica count.  Deployments are also used to manage safely rolling out changes to your running Pods.</p>

<p>Here is a Deployment that instantiates two nginx Pods:</p>



 













<table class="includecode" id="application-deployment-yaml">
    <thead>
        <tr>
            <th>
                <a href="https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/application/deployment.yaml" download="application/deployment.yaml">
                    <code>application/deployment.yaml</code>
                </a>
                <img src="../../../images/copycode.svg" style="max-height:24px" onclick="copyCode('application-deployment-yaml')" title="Copy application/deployment.yaml to clipboard">
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>apps/v1<span style="color:#bbb"> </span><span style="color:#080;font-style:italic"># for versions before 1.9.0 use apps/v1beta2</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Deployment<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>nginx-deployment<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>selector:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>matchLabels:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>app:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">  </span>replicas:<span style="color:#bbb"> </span><span style="color:#666">2</span><span style="color:#bbb"> </span><span style="color:#080;font-style:italic"># tells deployment to run 2 pods matching the template</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>template:<span style="color:#bbb"> </span><span style="color:#080;font-style:italic"># create pods using pod definition in this template</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># unlike pod-nginx.yaml, the name is not included in the meta data as a unique name is</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># generated from the deployment name</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>labels:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>app:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">    </span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>containers:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">        </span>image:<span style="color:#bbb"> </span>nginx:<span style="color:#666">1.7</span>.<span style="color:#666">9</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span>ports:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>-<span style="color:#bbb"> </span>containerPort:<span style="color:#bbb"> </span><span style="color:#666">80</span><span style="color:#bbb">
</span><span style="color:#bbb"></span></code></pre></div>  </td>
        </tr>
    </tbody>
</table>



<h3 id="deployment-management">Deployment Management</h3>

<p>Create an nginx Deployment:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f https://k8s.io/examples/application/deployment.yaml</code></pre></div>
<p>List all Deployments:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl get deployment</code></pre></div>
<p>List the Pods created by the Deployment:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl get pods -l <span style="color:#b8860b">app</span><span style="color:#666">=</span>nginx</code></pre></div>
<p>Upgrade the nginx container from 1.7.9 to 1.8 by changing the Deployment and calling <code>apply</code>.  The following config
contains the desired changes:</p>



 













<table class="includecode" id="application-deployment-update-yaml">
    <thead>
        <tr>
            <th>
                <a href="https://raw.githubusercontent.com/kubernetes/website/master/content/en/examples/application/deployment-update.yaml" download="application/deployment-update.yaml">
                    <code>application/deployment-update.yaml</code>
                </a>
                <img src="../../../images/copycode.svg" style="max-height:24px" onclick="copyCode('application-deployment-update-yaml')" title="Copy application/deployment-update.yaml to clipboard">
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>apps/v1<span style="color:#bbb"> </span><span style="color:#080;font-style:italic"># for versions before 1.9.0 use apps/v1beta2</span><span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Deployment<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>nginx-deployment<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>selector:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>matchLabels:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>app:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">  </span>replicas:<span style="color:#bbb"> </span><span style="color:#666">2</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>template:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>labels:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>app:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">    </span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>containers:<span style="color:#bbb">
</span><span style="color:#bbb">      </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">        </span>image:<span style="color:#bbb"> </span>nginx:<span style="color:#666">1.8</span><span style="color:#bbb"> </span><span style="color:#080;font-style:italic"># Update the version of nginx from 1.7.9 to 1.8</span><span style="color:#bbb">
</span><span style="color:#bbb">        </span>ports:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>-<span style="color:#bbb"> </span>containerPort:<span style="color:#bbb"> </span><span style="color:#666">80</span><span style="color:#bbb">
</span><span style="color:#bbb"></span></code></pre></div>  </td>
        </tr>
    </tbody>
</table>


<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl apply -f https://k8s.io/examples/application/deployment-update.yaml</code></pre></div>
<p>Watch the Deployment create Pods with new names and delete the old Pods:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl get pods -l <span style="color:#b8860b">app</span><span style="color:#666">=</span>nginx</code></pre></div>
<p>Delete the Deployment by name:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl delete deployment nginx-deployment</code></pre></div>
<p>For more information, such as how to rollback Deployment changes to a previous version, see <a href="../../concepts/workloads/controllers/deployment/index.html"><em>Deployments</em></a>.</p>

<h2 id="services">Services</h2>

<p>Once you have a replicated set of Pods, you need an abstraction that enables connectivity between the layers of your application.  For example, if you have a Deployment managing your backend jobs, you don&rsquo;t want to have to reconfigure your front-ends whenever you re-scale your backends.  Likewise, if the Pods in your backends are scheduled (or rescheduled) onto different machines, you can&rsquo;t be required to re-configure your front-ends.  In Kubernetes, the service abstraction achieves these goals.  A service provides a way to refer to a set of Pods (selected by labels) with a single static IP address. It may also provide load balancing, if supported by the provider.</p>

<p>For example, here is a service that balances across the Pods created in the previous nginx Deployment example (<a href="../service.yaml">service.yaml</a>):</p>



 













<table class="includecode" id="service-yaml">
    <thead>
        <tr>
            <th>
                <a href="https://github.com/kubernetes/website/blob/master/content/en/docs/tutorials/service.yaml" download="service.yaml">
                    <code>service.yaml docs/tutorials</code>
                </a>
                <img src="../../../images/copycode.svg" style="max-height:24px" onclick="copyCode('service-yaml')" title="Copy service.yaml to clipboard">
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Service<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>nginx-service<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>ports:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>port:<span style="color:#bbb"> </span><span style="color:#666">8000</span><span style="color:#bbb"> </span><span style="color:#080;font-style:italic"># the port that this service should serve on</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># the container on each pod to connect to, can be a name</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># (e.g. &#39;www&#39;) or a number (e.g. 80)</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>targetPort:<span style="color:#bbb"> </span><span style="color:#666">80</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>protocol:<span style="color:#bbb"> </span>TCP<span style="color:#bbb">
</span><span style="color:#bbb">  </span><span style="color:#080;font-style:italic"># just like the selector in the deployment,</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span><span style="color:#080;font-style:italic"># but this time it identifies the set of pods to load balance</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span><span style="color:#080;font-style:italic"># traffic to.</span><span style="color:#bbb">
</span><span style="color:#bbb">  </span>selector:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>app:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb"></span></code></pre></div>  </td>
        </tr>
    </tbody>
</table>



<h3 id="service-management">Service Management</h3>

<p>Create an nginx service (<a href="../service.yaml">service.yaml</a>):</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl create -f https://k8s.io/docs/tutorials/service.yaml</code></pre></div>
<p>List all services:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl get services</code></pre></div>
<p>On most providers, the service IPs are not externally accessible. The easiest way to test that the service is working is to create a busybox Pod and exec commands on it remotely. See the <a href="../../user-guide/kubectl-overview/index.html">command execution documentation</a> for details.</p>

<p>Provided the service IP is accessible, you should be able to access its http endpoint with wget on the exposed port:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">$ <span style="color:#a2f">export</span> <span style="color:#b8860b">SERVICE_IP</span><span style="color:#666">=</span><span style="color:#a2f;font-weight:bold">$(</span>kubectl get service nginx-service -o go-template<span style="color:#666">=</span><span style="color:#b44">&#39;{{.spec.clusterIP}}&#39;</span><span style="color:#a2f;font-weight:bold">)</span>
$ <span style="color:#a2f">export</span> <span style="color:#b8860b">SERVICE_PORT</span><span style="color:#666">=</span><span style="color:#a2f;font-weight:bold">$(</span>kubectl get service nginx-service -o go-template<span style="color:#666">=</span><span style="color:#b44">&#39;{{(index .spec.ports 0).port}}&#39;</span><span style="color:#a2f;font-weight:bold">)</span>
$ <span style="color:#a2f">echo</span> <span style="color:#b44">&#34;</span><span style="color:#b8860b">$SERVICE_IP</span><span style="color:#b44">:</span><span style="color:#b8860b">$SERVICE_PORT</span><span style="color:#b44">&#34;</span>
$ kubectl run busybox  --generator<span style="color:#666">=</span>run-pod/v1 --image<span style="color:#666">=</span>busybox --restart<span style="color:#666">=</span>Never --tty -i --env <span style="color:#b44">&#34;SERVICE_IP=</span><span style="color:#b8860b">$SERVICE_IP</span><span style="color:#b44">&#34;</span> --env <span style="color:#b44">&#34;SERVICE_PORT=</span><span style="color:#b8860b">$SERVICE_PORT</span><span style="color:#b44">&#34;</span>
u@busybox$ wget -qO- http://<span style="color:#b8860b">$SERVICE_IP</span>:<span style="color:#b8860b">$SERVICE_PORT</span> <span style="color:#080;font-style:italic"># Run in the busybox container
</span><span style="color:#080;font-style:italic"></span>u@busybox$ <span style="color:#a2f">exit</span> <span style="color:#080;font-style:italic"># Exit the busybox container
</span><span style="color:#080;font-style:italic"></span>$ kubectl delete pod busybox # Clean up the pod we created with <span style="color:#b44">&#34;kubectl run&#34;</span></code></pre></div>
<p>The service definition <a href="../../tasks/inject-data-application/downward-api-volume-expose-pod-information/index.html">exposed the Nginx Service</a> as port 8000 (<code>$SERVCE_PORT</code>). We can also access the service from a host running Kubernetes using that port:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">wget -qO- http://<span style="color:#b8860b">$SERVICE_IP</span>:<span style="color:#b8860b">$SERVICE_PORT</span> # Run on a Kubernetes host</code></pre></div>
<p>(This works on AWS with Weave.)</p>

<p>To delete the service by name:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-shell" data-lang="shell">kubectl delete service nginx-service</code></pre></div>
<p>When created, each service is assigned a unique IP address.  This address is tied to the lifespan of the Service, and will not change while the Service is alive.  Pods can be configured to talk to the service, and know that communication to the service will be automatically load-balanced out to some Pod that is a member of the set identified by the label selector in the Service.</p>

<p>For more information, see <a href="../../user-guide/services">Services</a>.</p>

<h2 id="health-checking">Health Checking</h2>

<p>When I write code it never crashes, right?  Sadly the <a href="https://github.com/kubernetes/kubernetes/issues" target="_blank">Kubernetes issues list</a> indicates otherwise&hellip;</p>

<p>Rather than trying to write bug-free code, a better approach is to use a management system to perform periodic health checking
and repair of your application.  That way a system outside of your application itself is responsible for monitoring the
application and taking action to fix it.  It&rsquo;s important that the system be outside of the application, since if
your application fails and the health checking agent is part of your application, it may fail as well and you&rsquo;ll never know.
In Kubernetes, the health check monitor is the Kubelet agent.</p>

<h3 id="process-health-checking">Process Health Checking</h3>

<p>The simplest form of health-checking is just process level health checking.  The Kubelet constantly asks the Docker daemon
if the container process is still running, and if not, the container process is restarted.  In all of the Kubernetes examples
you have run so far, this health checking was actually already enabled.  It&rsquo;s on for every single container that runs in
Kubernetes.</p>

<h3 id="application-health-checking">Application Health Checking</h3>

<p>However, in many cases this low-level health checking is insufficient.  Consider, for example, the following code:</p>
<div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-go" data-lang="go">lockOne <span style="color:#666">:=</span> sync.Mutex{}
lockTwo <span style="color:#666">:=</span> sync.Mutex{}

<span style="color:#a2f;font-weight:bold">go</span> <span style="color:#a2f;font-weight:bold">func</span>() {
  lockOne.Lock();
  lockTwo.Lock();
  <span style="color:#666">...</span>
}()

lockTwo.Lock();
lockOne.Lock();</code></pre></div>
<p>This is a classic example of a problem in computer science known as <a href="https://en.wikipedia.org/wiki/Deadlock" target="_blank">&ldquo;Deadlock&rdquo;</a>. From Docker&rsquo;s perspective your application is
still operating and the process is still running, but from your application&rsquo;s perspective your code is locked up and will never respond correctly.</p>

<p>To address this problem, Kubernetes supports user implemented application health-checks.  These checks are performed by the
Kubelet to ensure that your application is operating correctly for a definition of &ldquo;correctly&rdquo; that <em>you</em> provide.</p>

<p>Currently, there are three types of application health checks that you can choose from:</p>

<ul>
<li>HTTP Health Checks - The Kubelet will call a web hook.  If it returns between 200 and 399, it is considered success, failure otherwise. See health check examples <a href="../../user-guide/liveness/index.html">here</a>.</li>
<li>Container Exec - The Kubelet will execute a command inside your container.  If it exits with status 0 it will be considered a success. See health check examples <a href="../../user-guide/liveness/index.html">here</a>.</li>
<li>TCP Socket - The Kubelet will attempt to open a socket to your container.  If it can establish a connection, the container is considered healthy, if it can&rsquo;t it is considered a failure.</li>
</ul>

<p>In all cases, if the Kubelet discovers a failure the container is restarted.</p>

<p>The container health checks are configured in the <code>livenessProbe</code> section of your container config. There you can also specify an <code>initialDelaySeconds</code> that is a grace period from when the container is started to when health checks are performed, to enable your container to perform any necessary initialization.</p>

<p>Here is an example config for a Pod with an HTTP health check (<a href="../pod-with-http-healthcheck.yaml">pod-with-http-healthcheck.yaml</a>):</p>



 













<table class="includecode" id="pod-with-http-healthcheck-yaml">
    <thead>
        <tr>
            <th>
                <a href="https://github.com/kubernetes/website/blob/master/content/en/docs/tutorials/pod-with-http-healthcheck.yaml" download="pod-with-http-healthcheck.yaml">
                    <code>pod-with-http-healthcheck.yaml docs/tutorials</code>
                </a>
                <img src="../../../images/copycode.svg" style="max-height:24px" onclick="copyCode('pod-with-http-healthcheck-yaml')" title="Copy pod-with-http-healthcheck.yaml to clipboard">
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Pod<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>pod-with-http-healthcheck<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>containers:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">    </span>image:<span style="color:#bbb"> </span>nginx<span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># defines the health checking</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>livenessProbe:<span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># an http probe</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>httpGet:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>path:<span style="color:#bbb"> </span>/_status/healthz<span style="color:#bbb">
</span><span style="color:#bbb">        </span>port:<span style="color:#bbb"> </span><span style="color:#666">80</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># length of time to wait for a pod to initialize</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># after pod startup, before applying health checking</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>initialDelaySeconds:<span style="color:#bbb"> </span><span style="color:#666">30</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>timeoutSeconds:<span style="color:#bbb"> </span><span style="color:#666">1</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>ports:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>containerPort:<span style="color:#bbb"> </span><span style="color:#666">80</span><span style="color:#bbb">
</span><span style="color:#bbb"></span></code></pre></div>  </td>
        </tr>
    </tbody>
</table>



<p>And here is an example config for a Pod with a TCP Socket health check (<a href="../pod-with-tcp-socket-healthcheck.yaml">pod-with-tcp-socket-healthcheck.yaml</a>):</p>



 













<table class="includecode" id="pod-with-tcp-socket-healthcheck-yaml">
    <thead>
        <tr>
            <th>
                <a href="https://github.com/kubernetes/website/blob/master/content/en/docs/tutorials/pod-with-tcp-socket-healthcheck.yaml" download="pod-with-tcp-socket-healthcheck.yaml">
                    <code>pod-with-tcp-socket-healthcheck.yaml docs/tutorials</code>
                </a>
                <img src="../../../images/copycode.svg" style="max-height:24px" onclick="copyCode('pod-with-tcp-socket-healthcheck-yaml')" title="Copy pod-with-tcp-socket-healthcheck.yaml to clipboard">
            </th>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td><div class="highlight"><pre style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4"><code class="language-yaml" data-lang="yaml">apiVersion:<span style="color:#bbb"> </span>v1<span style="color:#bbb">
</span><span style="color:#bbb"></span>kind:<span style="color:#bbb"> </span>Pod<span style="color:#bbb">
</span><span style="color:#bbb"></span>metadata:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>name:<span style="color:#bbb"> </span>pod-with-tcp-socket-healthcheck<span style="color:#bbb">
</span><span style="color:#bbb"></span>spec:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>containers:<span style="color:#bbb">
</span><span style="color:#bbb">  </span>-<span style="color:#bbb"> </span>name:<span style="color:#bbb"> </span>redis<span style="color:#bbb">
</span><span style="color:#bbb">    </span>image:<span style="color:#bbb"> </span>redis<span style="color:#bbb">
</span><span style="color:#bbb">    </span><span style="color:#080;font-style:italic"># defines the health checking</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>livenessProbe:<span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># a TCP socket probe</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>tcpSocket:<span style="color:#bbb">
</span><span style="color:#bbb">        </span>port:<span style="color:#bbb"> </span><span style="color:#666">6379</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># length of time to wait for a pod to initialize</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span><span style="color:#080;font-style:italic"># after pod startup, before applying health checking</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>initialDelaySeconds:<span style="color:#bbb"> </span><span style="color:#666">30</span><span style="color:#bbb">
</span><span style="color:#bbb">      </span>timeoutSeconds:<span style="color:#bbb"> </span><span style="color:#666">1</span><span style="color:#bbb">
</span><span style="color:#bbb">    </span>ports:<span style="color:#bbb">
</span><span style="color:#bbb">    </span>-<span style="color:#bbb"> </span>containerPort:<span style="color:#bbb"> </span><span style="color:#666">6379</span><span style="color:#bbb">
</span><span style="color:#bbb"></span></code></pre></div>  </td>
        </tr>
    </tbody>
</table>



<p>For more information about health checking, see <a href="../../user-guide/pod-states/index.html#container-probes">Container Probes</a>.</p>

<h2 id="what-s-next">What&rsquo;s Next?</h2>

<p>For a complete application see the <a href="https://github.com/kubernetes/examples/tree/v1.11.3/guestbook/" target="_blank">guestbook example</a>.</p>



				<div class="issue-button-container">
					<p><a href="../../user-guide/walkthrough/k8s201/index.html"><img src="https://kubernetes-site.appspot.com/UA-36037335-10/GitHub/docs/tutorials/k8s201.md?pixel" alt="Analytics" /></a></p>
					
					
					<script type="text/javascript">
					PDRTJS_settings_8345992 = {
					"id" : "8345992",
					"unique_id" : "\/docs\/tutorials\/k8s201\/",
					"title" : "Kubernetes 201",
					"permalink" : "https:\/\/kubernetes.io\/docs\/tutorials\/k8s201\/"
					};
					(function(d,c,j){if(!document.getElementById(j)){var pd=d.createElement(c),s;pd.id=j;pd.src=('https:'==document.location.protocol)?'https://polldaddy.com/js/rating/rating.js':'http://i0.poll.fm/js/rating/rating.js';s=document.getElementsByTagName(c)[0];s.parentNode.insertBefore(pd,s);}}(document,'script','pd-rating-js'));
					</script>
					<a href="../../user-guide/walkthrough/k8s201/index.html" onclick="window.open('https://github.com/kubernetes/website/issues/new?title=Issue%20with%20' +
					'k8s.io'+window.location.pathname)" class="button issue">Create an Issue</a>
					
					
					
					<a href="../../editdocs#docs/tutorials/k8s201.md" class="button issue">Edit this Page</a>
					
				</div>
			</div>
		</section>
		<footer>
    <main class="light-text">
        <nav>
            
            
            
            <a href="../../home.1">Documentation</a>
            
            <a href="../../../blog/index.html">Blog</a>
            
            <a href="../../../partners/index.html">Partners</a>
            
            <a href="../../../community/index.html">Community</a>
            
            <a href="../../../case-studies/index.html">Case Studies</a>
            
        </nav>
        <div class="social">
            <div>
                <a href="https://twitter.com/kubernetesio" class="twitter"><span>twitter</span></a>
                <a href="https://github.com/kubernetes/kubernetes" class="github"><span>Github</span></a>
                <a href="http://slack.k8s.io/" class="slack"><span>Slack</span></a>
            </div>
            <div>
                <a href="http://stackoverflow.com/questions/tagged/kubernetes" class="stack-overflow"><span>Stack Overflow</span></a>
                <a href="https://discuss.kubernetes.io" class="mailing-list"><span>Forum</span></a>
                <a href="https://calendar.google.com/calendar/embed?src=nt2tcnbtbied3l6gi2h29slvc0%40group.calendar.google.com" class="calendar"><span>Events Calendar</span></a>
            </div>
            <div>
                <a href="../../getting-started-guides/index.html" class="button">Get Kubernetes</a>
                <a href="https://git.k8s.io/community/contributors/guide" class="button">Contribute</a>
            </div>
        </div>
        <div id="miceType" class="center">
            &copy; 2018 The Kubernetes Authors | Documentation Distributed under <a href="https://git.k8s.io/website/LICENSE" class="light-text">CC BY 4.0</a>
        </div>
        <div id="miceType" class="center">
            Copyright &copy; 2018 The Linux Foundation&reg;. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our <a href="https://www.linuxfoundation.org/trademark-usage" class="light-text">Trademark Usage page</a>
        </div>
    </main>
</footer>

		<button class="flyout-button" onclick="kub.toggleToc()"></button>

<script>
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
    (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-36037335-10', 'auto');
ga('send', 'pageview');


(function () {
    window.addEventListener('DOMContentLoaded', init)

        
        function init() {
            window.removeEventListener('DOMContentLoaded', init)
                hideNav()
        }

    function hideNav(toc){
        if (!toc) toc = document.querySelector('#docsToc')
        if (!toc) return
            var container = toc.querySelector('.container')

                
                if (container) {
                    if (container.childElementCount === 0 || toc.querySelectorAll('a.item').length === 1) {
                        toc.style.display = 'none'
                            document.getElementById('docsContent').style.width = '100%'
                    }
                } else {
                    requestAnimationFrame(function () {
                        hideNav(toc)
                    })
                }
    }
})();
</script>



	</body>
</html>